﻿using System.Collections.Generic;
using System.Linq;
using Diploma.Models.IRepositories;
using Microsoft.Office.Interop.Word;

namespace Diploma.Models.Repositories
{
    internal class PlaningTypesRepository : IPlaningTypesRepository
    {
        private readonly DiplomaEntities dataContext;

        public PlaningTypesRepository(DiplomaEntities dataContext)
        {
            this.dataContext = dataContext;
        }

        public PlaningType GetPlaningType(int id)
        {
            return dataContext.PlaningTypes.Where(pt => pt.PlaningTypeId == id).FirstOrDefault();
        }

        public IEnumerable<PlaningType> GetAllPlaningTypes()
        {
            return dataContext.PlaningTypes.OrderBy(pt => pt.Name);
        }
    }
}